import { createCallerFactory, createTRPCRouter } from "~/server/api/trpc";
import { authRouter } from "./routers/auth";
import { coursesRouter } from "./routers/courses";
import { courseRouter } from "./routers/course";
import { tasksRouter } from "./routers/tasks";
import { stepsRouter } from "./routers/steps";
import { taskContentRouter } from "./routers/taskContent";
import { courseInvitationsRouter } from "./routers/courseInvitations";

/**
 * This is the primary router for your server.
 *
 * All routers added in /api/routers should be manually added here.
 */
export const appRouter = createTRPCRouter({
  auth: authRouter,
  courses: coursesRouter,  // 教师视角的课程管理
  course: courseRouter,    // 学生视角的课程操作
  tasks: tasksRouter,
  steps: stepsRouter,
  taskContent: taskContentRouter,
  courseInvitations: courseInvitationsRouter,
  // TODO: 以下路由将在后续实现
  // steps: stepsRouter,     // 步骤管理
  // comments: commentsRouter,// 评论系统
  // ratings: ratingsRouter, // 评分系统
  // forum: forumRouter,    // 学校论坛
  // admin: adminRouter,    // 管理员功能
});

// export type definition of API
export type AppRouter = typeof appRouter;

/**
 * Create a server-side caller for the tRPC API.
 * @example
 * const trpc = createCaller(createContext);
 * const res = await trpc.post.all();
 *       ^? Post[]
 */
export const createCaller = createCallerFactory(appRouter);
